<template>
  <div class="WorkingSchedule">
    <div class="a4" id="printMeP">
      <div class="a4-title">入库退货单</div>
      <div class="a4-model">
        <div class="a4-model-one">
          <div class="a4-model-one-left">
            <div style="margin-right: 40px">工厂：{{ factory_name }}</div>
            <div>总数量：{{ num }}</div>
          </div>
          <div>打印时间：{{ print_time }}</div>
        </div>
        <el-table :data="list" border style="width: 100%">
          <el-table-column prop="sku_code" label="SKU" align="center">
          </el-table-column>
          <el-table-column prop="adduser" label="审批创建人" align="center">
          </el-table-column>
          <el-table-column prop="num" label="数量" align="center">
          </el-table-column>
        </el-table>
        <div style="display: flex;justify-content: flex-end;margin-top:10px">
          <div style="width:200px">工厂签字:</div>
        </div>
      </div>
    </div>
    <el-button
      v-print="'printMeP'"
      style="display: none"
      id="printbtn"
    ></el-button>
  </div>
</template>

<script>
import { postWarehousesetdispatchretuenprintlist } from "@/api";
export default {
  data() {
    return {
      factory_name: "",
      num: "",
      print_time: "",
      list: [],
    };
  },
  async mounted() {},
  methods: {
    async print(arr) {
      let obj = {
        ids: arr,
      };
      let res = await postWarehousesetdispatchretuenprintlist(obj);
      let data = res.data;
      this.factory_name = data.factory_name;
      this.num = data.num;
      this.print_time = data.print_time;
      this.list = data.list;
      document.getElementById("printbtn").click();
    },
  },
};
</script>

<style lang="scss" scoped>
.a4 {
  width: 210mm;
  background: #fff;
  padding-top: 2mm;
  font-size: 14px;
  /deep/ .el-table--border {
    border: 1mm solid #ebeef5;
  }
  .a4-title {
    text-align: center;
    font-size: 18px;
    font-weight: 600;
    padding: 4mm 0;
  }
  .a4-model {
    width: 200mm;
    margin: 0 auto;
    .a4-model-one {
      display: flex;
      justify-content: space-between;
      .a4-model-one-left {
        display: flex;
      }
      margin-bottom: 10px;
    }
  }
}
.WorkingSchedule {
  background: #ffff;
  padding: 20px;
  border-radius: 2px;
  @include boxShadow;
}
</style>